package com.itheima.stock.config;

import com.itheima.stock.properties.IdWorkProperties;
import com.itheima.stock.util.IdWorkers;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zby
 * @created 2024-06-25 10:44
 * @description id 生成器
 */
@Configuration
public class IdWorkersConfiguration {

    @Bean
    public IdWorkers idWorkers(IdWorkProperties properties) {
        return new IdWorkers(properties.getMachineId(), properties.getDatacenterId());
    }

}
